#ifndef CLIENTMAINTHREAD_H
#define CLIENTMAINTHREAD_H

class ClientWorld;
#include "MainHeader.h"

#include "CommunicationProtocol.h"

#include <map>

#ifdef CLIENT

class ClientMainThread {
private:
	bool					m_Terminate;
	SOCKET					m_Socket;

	ClientWorld*			m_pWorld;
	std::map<int,HANDLE>	m_Events;
	int						m_CurEventID;
protected:
	static DWORD WINAPI run( LPVOID pParam );

	int	   Dispatch(BYTE * memory, int size);
public:
	HANDLE				m_Thread_Handle;

	ClientMainThread( ClientWorld* pWorld);

	void Terminate();

	int Send(BYTE * memory, int size);
	int Send(Protostruct proto, BYTE * memory, int size, bool blocking = false);
};
#endif /* CLIENT */

#endif